package uccimpl;

import ucc.Service;
import util.CheckParameters;
import daoimpl.PersonDaoImpl;
import domain.Person;
import exceptions.InvalidParameterException;
import exceptions.NullParameterException;

public class PersonService extends Service<Person> {
	
	private static PersonService instance;
	@SuppressWarnings("unused")
	private PersonDaoImpl dao;
	
	protected PersonService(PersonDaoImpl dao) {
		super(dao);
		this.dao = dao;
	}
	
	public static PersonService getInstance() {
		if (instance == null) {
			instance = new PersonService(new PersonDaoImpl());
		}
		return instance;
	}

	@Override
	protected void businessRules(Person entity) throws NullParameterException,
			InvalidParameterException {
		CheckParameters.checkNull(entity, "entity");
		CheckParameters.checkStringEmpty(entity.getName(), "name");
	}

}
